import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
      ),

      //SizedBox修饰的是子元素的大小
      body: SizedBox(
        height: 400,
        width: 400,
        child: Stack(
          //左对齐，还是右对齐
          alignment: Alignment.topRight,
          children: <Widget>[
            Positioned(
              //left: 15,
              top: 30,
              child: Container(
                width: 100,
                height: 100,
                color: Colors.red,
              ),
            ),
            Positioned(
              right: 100,
              top: 100,
              child: Container(
                width: 200,
                height: 200,
                color: Colors.black,
              ),
            )
          ],
        ),
      )
    );
  }

}
